package initialize

import (
	"doctor_srv/global"
	"github.com/winksai/utils/mysql"
	"github.com/winksai/utils/nacos"
	"github.com/winksai/utils/viper"
)

func init() {
	Viper()
	Nacos()
	Mysql()
}

func Viper() {
	viper.Viper("./dev.yaml")
}

func Nacos() {
	read := viper.GetNacos()
	nacos.Nacos(read.NameSpace, read.Username, read.Password, read.Addr, read.Port, read.DataID, read.Group)
}
func Mysql() {
	config := nacos.GetConfig()
	db := mysql.InitMysql(config.Mysql.User, config.Mysql.Password, config.Mysql.Host, config.Mysql.Database, config.Mysql.Port)
	//db.AutoMigrate(&model.Doctor{}, &model.Patient{}, &model.Folder{}, &model.Record{})
	global.DB = db
}
